class TimeUtil {
  getCurrentDate(): string {
    const date = new Date();
    const year = date.getFullYear();
    const month = date.getMonth() + 1;
    const day = date.getDate();

    return `${year}-${this.getNum(month)}-${this.getNum(day)}`;
  }

  getCurrentTime(): string {
    const date = new Date();
    const year = date.getFullYear();
    const month = date.getMonth() + 1;
    const day = date.getDate();

    const hour = date.getHours()
    const minute = date.getMinutes()
    const second = date.getSeconds()

    return `${year}-${this.getNum(month)}-${this.getNum(day)} ${this.getNum(hour)}:${this.getNum(minute)}:${this.getNum(second)}`;
  }

  private getNum(num: number): string {
    return `${num < 10 ? '0' + num : num}`
  }
}

export default new TimeUtil()